package online2;

import java.io.IOException;
import java.util.HashMap;

public class TcpDictServer extends TcpThreadEchoServer{
    private HashMap<String,String> dict=new HashMap<>();
    public TcpDictServer(int port) throws IOException {
        super(port);
        dict.put("hello","你好");
        dict.put("dog","小狗");
        dict.put("cat","小猫");
    }
    @Override
    public String process(String request){
        return this.dict.getOrDefault(request,"[要查的词不存在]");
    }
    public static void main(String[] args) throws IOException {
        TcpDictServer server=new TcpDictServer(9090);
        server.start();
    }
}
